<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			.deleteSuccess:after{
				content: "删除成功";
				color: red;
				font-size: 1rem;
				margin-left: 5px;
			}
			.deleteFaild:after{
				content: "删除失败";
				color: red;
				font-size: 1rem;
				margin-left: 5px;
			}
		</style>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<meta name="renderer" content="webkit">
		<title></title>
		<link rel="stylesheet" href="css/pintuer.css">
		<link rel="stylesheet" href="css/admin.css">
		<link rel="stylesheet" type="text/css" href="../../css/public/bootstrap.min.css" />
		<script src="js/jquery.js"></script>
		<script src="js/pintuer.js"></script>
	</head>
	<body>
		<div class="userManage_wrap">
			<div class="panel admin-panel">
			<div class="panel-head"><strong class="icon-reorder"> 用户列表</strong>
				<a href="" style="float:right; display:none;">添加字段</a>
			</div>
			<table class="table table-hover text-center" id="goodsList">
				<tr>
					<th width="25%">用户昵称</th>
					<th width="25%">用户登录账号</th>
					<th width="25%">用户头像</th>
					<th width="25%">操作</th>
				</tr>
				
			</table>
		</div>
		</div>
	</body>
	<script type="text/javascript">
		$.ajax({
			type:"get",
			url:"http://115.28.227.1/projects/xa/php/php08/Back/backCommon.php",
			async:true,
			data:{
				type:"getAllUserInfo"
			},
			success:function(res){
				var response = JSON.parse(res);
				for(var i = 0;i < response.length;i++){
					$("#goodsList").append("<tr><td>" + response[i].NickName + "</td><td>" + response[i].UserName + "</td><td><img src='" + response[i].HeadImg + "'/></td><td><div class='deleteUserBtn' onclick='deleteUserClick(this)'><button class='btn btn-danger'>删除</button></div></td></tr>");
				}
				$("#goodsList").find("tr td").css({
					"height":"80px",
					"line-height":"80px"
				})
				$("#goodsList").find("img").css({
					"width":"100px",
					"height":"100px"
				})		
				$(".deleteUserBtn").parent().css({
					"text-align":"left"
				})
				$(".deleteUserBtn").css({
					"display":"inline-block",
					"margin-left":"130px"
				})
			}
		});
		
			function deleteUserClick(obj){
					var resUsername = $(obj).parent().parent().find("td:eq(1)").text();
					$.ajax({
						type:"get",
						url:"http://115.28.227.1/projects/xa/php/php08/Back/backCommon.php",
						async:true,
						data:{
							type:"deleteUserInfo",
							username:resUsername
						},
						success:function(res){
							if(res.errcode == "0"){
								$(obj).addClass("deleteSuccess");
								setTimeout(function(){
									window.history.go(0);
									
								},1000)
							}else{
								$(obj).addClass("deleteFaild");
							}
						}
					});
				}
	</script>
</html>
